<template>
  <h2>根组件:{{ $store.state.name }}</h2>
  <h2>子组件:{{ $store.state.rosy.name }}</h2>

  <h2>当前计数：{{ $store.state.rosy.counter }}</h2>
  <h2>当前计数三倍：{{ $store.getters["rosy/tripleCounter"] }}</h2>

  <button @click="rosyAdd">+1</button>
  <button @click="rosyAddAsyn">延时+1</button>

  <hr />
</template>

<script>
export default {
  methods: {
    rosyAdd() {
      this.$store.commit("rosy/increment")
    },
    rosyAddAsyn() {
      this.$store.dispatch("rosy/incrementAsyn")
    },
  },
}
</script>

<style></style>
